const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sunnyCitys', {
    id: {
      type: DataTypes.STRING(12),
      allowNull: false,
      primaryKey: true,
      comment: "区划编号"
    },
    parentId: {
      type: DataTypes.STRING(12),
      allowNull: true,
      comment: "父区划编号",
      field: 'parent_id'
    },
    name: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "区划名称"
    },
    sort: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "排序"
    },
    remark: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "备注"
    },
    createUser: {
      type: DataTypes.STRING(30),
      allowNull: true,
      comment: "创建人",
      field: 'create_user'
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'create_time'
    },
    updateUser: {
      type: DataTypes.STRING(30),
      allowNull: true,
      comment: "更新人",
      field: 'update_user'
    },
    updateTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "更新时间",
      field: 'update_time'
    },
    deleteTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "删除时间",
      field: 'delete_time'
    },
    hierarchyLevel: {
      type: DataTypes.INTEGER,
      allowNull: true,
      field: 'hierarchy_level'
    }
  }, {
    sequelize,
    tableName: 'sunny_citys',
    timestamps: true,
    createdAt: 'createTime',
    updatedAt: 'updateTime',
    deletedAt: 'deleteTime',
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
